<template>
  <div class="mui-pages" style="background-color: #fff;">
    <header class="mui-bar mui-bar-nav">
      <div class="header-common-title flex-justify-start">
        <span @click="fn.back()" class="mui-action-back"><img class="back-btn" src="../../../../static/images/back.png"></span>
        <div class="header-search flex-center">答题结果</div>
      </div>
    </header>
    <div class="mui-scroll-wrapper">
      <div class="mui-scroll">
        <div v-if="answerRes.data.score === 1 || answerRes.data.score === 0.9 || answerRes.data.score === 0.8 || answerRes.data.answerCount === 3" class="login-main flex-column flex-center">
          <img src="../../../../static/images/state_success.png" width="80px">
          <h4 class="work-message-lists">恭喜你，完成本次在线学习答题！</h4>
          <p v-if="answerRes.data.score !== 0.5" class="work-red">{{answerRes.data.answerCount}}次答完通过，答题积分+{{answerRes.data.score}}分</p>
          <p v-if="answerRes.data.answerCount === 3 && answerRes.data.score === 0.5" class="work-red">{{answerRes.data.answerCount}}次答完未通过，答题积分+{{answerRes.data.score}}分</p>
          <div @click="goAnswerDetail" class="sign-end-btn">查看试题详情</div>
          <div @click="fn.back()" class="sign-end-btn" style="background-color: #ccc;">返回首页</div>
        </div>
        <div v-if="answerRes.data.score === 0.5 && answerRes.data.answerCount !== 3" class="login-main flex-column flex-center">
          <img src="../../../../static/images/state_success.png" width="80px">
          <p class="work-red">{{answerRes.message}}</p>
          <div @click="continueAnswer" class="sign-end-btn">继续答题</div>
          <div @click="fn.back()" class="sign-end-btn" style="background-color: #ccc;">返回首页</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  import tools from '@/utils/tools'
  import loginService from '@/service/loginService'
  export default {
    name: 'answerConsult',
    data () {
      return {
        fn: tools,
        options: {
          pullUpLoad: true,
          scrollbar: false
        },
        answerRes: {},
        weekPlanId: ''
      }
    },
    created () {
      this.answerRes = this.$localStorage.get('answerRes')
      this.weekPlanId = this.answerRes.weekPlanId
    },
    methods: {
      continueAnswer () {
        this.$router.replace({path: `/answerBegin/${this.weekPlanId}`})
      },
      backIndex () {

      },
      goAnswerDetail () {
        this.$router.replace({path: `/answerDetails/${this.weekPlanId}/2`})
      }
    }
  }
</script>

<style scoped>

</style>
